﻿@section header
{
    <link rel="stylesheet" href="~/Themes/RongJi/Style/base/css/sign.css?v=1">
}
@section title
{
    修改密码
}
@section pagetitle
{
    修改密码
}
@model RiderShop.Mobile.Modle.CustomerModel
    <div class="userCenterHeader">
        <span class="iconWrapper">
            <img src="~/Themes/RongJi/Style/base/imgs/icon_mi.png">
        </span>
        <h3>修改密码</h3>
        <br class="clearfix">
    </div>
    <form action="~/Customer/ResetPassword" id="pwdForm">
        <div class="body">


            <input type="hidden" id="forgetpwd" name="forgetpwd" value='@Request.QueryString["forgetpwd"]' />

            <input type="password" id="newPwd" maxlength="20" name="newPwd" value="" class="form-control" placeholder="请输入新密码">
            <input type="password" id="txtRePassword" maxlength="20" value="" class="form-control" placeholder="请输入确认密码">
            @if (Model.Result != null && !Model.Result.Status)
            {
                <span class="err_msg">@Model.Result.ErrorMessage</span>
            }
            else
            {
                <span class="err_msg" id="msgError"></span>
            }
        </div>
        <div class="bottom">
            <div class="btn-group btn-group-justified btn-wrapper" role="group" aria-label="...">
                <div class="btn-group" role="group">
                    <input type="button" id="btnSubmit" class="btn btn-green" value="保存">
                </div>
                <div class="btn-group" role="group">
                    <a type="button" href="~/MyAccount/Home" class="btn">取消</a>
                </div>
            </div>
        </div>
    </form>





    @section footer
{

        <script type="text/javascript">

            $(function () {
                //让底部toolbar选中
                var $homeImg = $("#homeImg");
                var $categoryImg = $("#categoryImg");
                var $myaccountImg = $("#myaccountImg");
                var $searchImg = $("#searchImg");
                $homeImg.attr("src", "/Themes/RongJi/Style/base/imgs/f10.png");
                $categoryImg.attr("src", "/Themes/RongJi/Style/base/imgs/f2.png");
                $myaccountImg.attr("src", "/Themes/RongJi/Style/base/imgs/f3_c.png");
                $searchImg.attr("src", "/Themes/RongJi/Style/base/imgs/f4.png");

                $("#btnSubmit").click(function () {

                    if ($('#newPwd').val() == "") {
                        KevinShop.MessageBox.Alert("请输入新密码!");
                        return false;
                    }
                    if ($('#txtRePassword').val() == "") {
                        KevinShop.MessageBox.Alert("请输入确认密码!");
                        return false;
                    }
                    if ($('#newPwd').val() != $('#txtRePassword').val()) {
                        KevinShop.MessageBox.Alert("请确认新密码和确认密码是一样的!");
                        return false;
                    }
                    postdata = "{'forgetpwd':'" + $("#forgetpwd").val() + "','newPwd':'" + $("#newPwd").val() + "'}"
                    KevinShop.Common.Ajax.Post(document.forms["pwdForm"].action, postdata, function (data) {
                        if (data) {
                            isCodeSended = false;
                            KevinShop.MessageBox.Alert(data);
                        }
                        else {
                            KevinShop.MessageBox.Success("密码重置成功，请登录！");
                            setTimeout(function () {
                                window.location.href = "login";
                            }, 1500);

                        }
                    });

                    return false;
                });
            });
        </script>
    }
